<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
<link rel="stylesheet" href="/plugins/select2/css/select2.min.css">
<link rel="stylesheet" href="/plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css">
<th:block data-th-replace="/adminlte/base::base-head"></th:block>
<link rel="stylesheet" href="/plugins/datatables-bs4/css/dataTables.bootstrap4.css">
</head>
<body class="hold-transition sidebar-mini layout-fixed">
<div class="modal fade" id="dialog-exchange-add">
   <div class="modal-dialog">
       <div class="modal-content" style="border-radius:5px; margin-top: 10%; border-radius: 5px;">
       	<div class="modal-header">
       		<h4 class="modal-title">新增兑换</h4>
			<button type="button" class="close" data-dismiss="modal" aria-label="Close">
				<span aria-hidden="true">&times;</span>
			</button>
		</div>
		<form role="form" action="/currencys/exchanges" method="post">
			<div class="modal-body">
				<div class="form-group">
					<label>原始货币</label>
					<select class="form-control select2" name="fromId">
					    <option data-th-each="currency:${currencyList}" th:utext="${currency.name}" th:value="${currency.id}"></option>
					</select>
				</div>
				<div class="form-group">
					<label>目标货币</label>
					<select class="form-control select2" name="toId">
					    <option data-th-each="currency:${currencyList}" th:utext="${currency.name}" th:value="${currency.id}"></option>
					</select>
				</div>
				<div class="form-group">
					<label><span class="text-red">*</span> 货币数量</label> <input type="text" class="form-control" name="change" placeholder="货币数量" autofocus="autofocus">
				</div>
			</div>
			<div class="modal-footer">
				<button class="btn btn-default float-left" data-dismiss="modal" style="width: 100px" type="button">取消</button>
                <button class="btn btn-success float-right" style="width: 100px" type="submit">确定</button>
				</div>
			</form>
        </div>
    </div>
</div>
<div class="wrapper">
<th:block data-th-replace="/adminlte/base::base-navbar"></th:block>
<th:block data-th-replace="/adminlte/base::base-main-sidebar"></th:block>
<div class="content-wrapper">
	<th:block data-th-replace="/adminlte/base::base-content-header"></th:block>
	<section class="content">
		<div class="container-fluid">
	      <div class="card">
	            <div class="card-header">
	            	<div class="row mt-2">
		              <button class="btn btn-app" data-dialog="show" data-url="#dialog-exchange-add">
		                <i class="fas fa-plus text-blue"></i> 新增兑换
		              </button>
	            	</div>
	            </div>
	            
	            <div class="card-body table-responsive">
	            	<div class="table-responsive">
		              <table id="exchange-table" class="table table-bordered table-hover" data-url="/currencys/exchanges/">
		              	<colgroup>
		              		<col width="80"/>
		              		<col width="200"/>
		              		<col width="200"/>
		              		<col/>
		              		<col width="80"/>
		              	</colgroup>
		                <thead>
			                <tr>
								<th>id</th>
								<th>货币</th>
								<th>转换</th>
								<th>数量</th>
								<th>操作</th>
			                </tr>
		                </thead>
		                <tbody>
		                	<tr data-th-each="currencyExchange : ${currencyExchangeList}" th:data-key="${currencyExchange.id}">
								<td data-th-utext="${currencyExchange.id}">排序</td>
								<td data-th-utext="${currencyUtils.getName(currencyExchange.fromId)}">角色名称</td>
								<td data-th-utext="${currencyUtils.getName(currencyExchange.toId)}">角色名称</td>
								<td data-th-utext="${currencyExchange.change}" data-col-name="change" contenteditable="true">角色名称</td>
								<td class="td-manage">
									<a title="删除兑换" 
									    data-dialog="confirm"
									    data-url="/currencys/exchanges/"
									    data-method="delete"
									    th:data-path="${currencyExchange.id}" 
									    data-dialog-t-msg="您确定要删除当前货币兑换规则吗？"
									    style="margin-left: 10px;">
										<i class="fas fa-trash text-blue"></i>
									</a>
								</td>
							</tr>
		                </tbody>
		              </table>
	            	</div>
	            </div>
	     	</div>
		</div>
	</section>
</div>
<th:block data-th-replace="/adminlte/base::base-footer"></th:block>
<th:block data-th-replace="/adminlte/base::base-control-sidebar"></th:block>
</div>
<script src="/plugins/datatables/jquery.dataTables.js"></script>
<script src="/plugins/datatables-bs4/js/dataTables.bootstrap4.js"></script>
<script src="/kaibes/js/table-data.js"></script>
<script src="/kaibes/js/table-update.js"></script>
<script src="/plugins/select2/js/select2.full.min.js"></script>
<script type="text/javascript">
	dataTable(0, [4]);
	$('.select2').select2();
</script>
</body>
</html>